__auth__ = "miao.zhifeng<19195659@qq.com>"
__doc__ = """ 
由串生成6位数字密码
假设使用姓名全拼来生成
s = "miao.zhifeng<19195659@qq.com>"
1. 按照6位字母一行，上下对齐
2. 每列字母的ascii值相加
3. 缩位处理
"""

s = "miao.zhifeng" #<19195659@qq.com>"

# 用6分组，位序同余数的ascii码值求和
def explode2(src):
	s = [0]*6
	if len(src)==0: return -1
	for i in range(len(src)):
		s[i%6] += ord(src[i])
	return tuple(s)


# 缩位处理
def shorten(num):
	if num>0 and num<=9: return num
	n = 0
	while num != 0:
		num,r = num//10, num%10
		n += r
	return shorten(n)
tp = explode2(s)
for x in tp:
	print("每列求和值{0:4d},缩位后值{1}".format(x,shorten(x)))
